<!--
    改派缘由配置
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:replace="common/common :: jscss"/><title>改派缘由配置</title>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <form method="post" action="" class="layui-form" id="zmn-form" lay-filter="zmn-form">
                <input type="hidden" th:value="${conf.id}" name="id">

                <th:block th:if="${conf.id != null}">
                    <label class="layui-form-label">ID：</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid">
                            <span id="contentId">[[${conf.id}]]</span>
                        </div>
                    </div>
                </th:block>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">改派缘由：</label>
                    <div class="layui-input-inline" style="width: 260px;">
                        <input type="text" placeholder="改派缘由" maxlength="50" id="reason" name="reason"
                               lay-verify="reasonVerify"
                               th:value="${conf.reason}" class="layui-input"/>
                    </div>
                    <div class="layui-input-inline" style="width: 30px;"><div id="color-form"></div></div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">适用平台：</label>
                    <div class="layui-input-inline" style="width: 500px;">
                        <input type="checkbox" lay-skin="primary" name="plat"
                               lay-verify="platVerify"
                                th:each="plat:${T(com.zmn.common.constant.GlobalConsts).getPlatList()}"
                                th:title="${plat.value}"
                                th:value="${plat.key}"
                                th:checked="${#stringUtils.contains(conf.plat, plat.key+'')}"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">订单类型：</label>
                    <div class="layui-input-inline" style="width: 500px;">
                        <input type="checkbox" lay-skin="primary" name="orderType"
                               lay-verify="orderTypeVerify"
                               th:each="orderType:${T(com.zmn.oms.common.constant.OrderConsts).getOrderTypeList()}"
                               th:title="${orderType.value}"
                               th:value="${orderType.key}"
                               th:checked="${#stringUtils.contains(conf.orderType, orderType.key+'')}"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">发起人：</label>
                    <div class="layui-input-inline" style="width: 500px;">
                        <input type="checkbox" lay-skin="primary" name="applyType"
                               lay-verify="applyTypeVerify"
                               th:each="applyType:${T(com.zmn.oms.common.constant.ConfRedistributeConsts).getApplyTypeList()}"
                               th:title="${applyType.value}"
                               th:value="${applyType.key}"
                               lay-filter="applyType"
                               th:checked="${#stringUtils.contains(conf.applyType, applyType.key+'')}"/>
                    </div>
                    <div class="layui-form-mid layui-word-aux" style="font-size: 12px">发起人为“运营后台”时，改派流程默认为指定改派</div>
                </div>

                <div class="layui-form-item" style="display: none;margin: 0px;" id="redistribute-step">
                    <label class="layui-form-label layui-form-required">改派流程：</label>
                    <div class="layui-input-inline" style="width: 900px">

                        <div class="layui-form-item" style="display: none;" th:id="|redistribute-step-${applyType.key}|"
                             th:each="applyType:${T(com.zmn.oms.common.constant.ConfRedistributeConsts).getApplyTypeList()}">

                            <div class="layui-inline" style="width: 560px;">
                                <label class="layui-form-label" style="width:70px;padding:7px 0;" th:text="|${applyType.value}：|"></label>
                                <!-- 不循环 “运营后台” 的改派流程下拉框 -->
                                <div th:unless="${applyType.key == 2}">

                                    <div class="layui-input-inline" style="width: 135px">
                                        <!-- “系统”的 改派流程 排除“转单求助-指定” -->
                                        <select lay-verify="required" th:lay-filter="|help-type-${applyType.key}|" class="helpType">
                                            <option th:each="helpType:${T(com.zmn.oms.common.enums.ConfRedistributeHelpTypeEnum).getHelpTypeList()}"
                                                    th:text="${helpType.value}"
                                                    th:value="${helpType.key}"
                                                    th:unless="${applyType.key == 1 && helpType.key == 2}"></option>
                                        </select>
                                    </div>

                                    <span style="float: left;line-height: 34px;margin-right: 10px;">—</span>

                                    <div class="layui-input-inline" style="width: 135px">
                                        <select lay-verify="required" th:lay-filter="|audit-type-${applyType.key}|" class="auditType">
                                            <option th:each="auditType:${T(com.zmn.oms.common.enums.ConfRedistributeAuditTypeEnum).getAuditTypeList()}"
                                                    th:text="${auditType.value}"
                                                    th:value="${auditType.key}"></option>
                                        </select>
                                    </div>

                                    <span style="float: left;line-height: 34px;margin-right: 10px;">—</span>

                                    <div class="layui-input-inline" style="width: 135px">
                                        <select lay-verify="required" class="redistributeType">
                                            <option th:each="redistributeType:${T(com.zmn.oms.common.enums.ConfRedistributeTypeEnum).getRedistributeTypeList()}"
                                                    th:text="${redistributeType.value}"
                                                    th:value="${redistributeType.key}"></option>
                                        </select>
                                    </div>
                                </div>
                                <!-- 当是 “运营后台” 时，展示 “指定改派” 字样 -->
                                <div th:if="${applyType.key == 2}" style="width: 560px">
                                    <div class="layui-input-inline" style="line-height: 34px;">
                                        指定改派
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label"  style="padding: 0;width: 70px;">&nbsp;</label>
                            <div class="layui-input-inline" style="width: 800px;">
                                <div class="layui-form-mid layui-word-aux" style="font-size: 12px;padding: 0px !important;">转单求助-定向/范围：指向附近符合条件的指定工程师或者所有工程师发起改派求助；求助期间，若无人领单，执行后面流程，若有人领单，流程结束</div>
                                <div class="layui-form-mid layui-word-aux" style="font-size: 12px;padding: 0px !important;">指定/系统改派：指将订单派给指定的工程师或者由系统派给最优工程师</div>
                                <div class="layui-form-mid layui-word-aux" style="font-size: 12px;padding: 0px !important;">改派流程说明：转单求助期间，若有工程师主动领单，则订单直接改派给领单工程师，若无工程师领单</div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">责任归属：</label>
                    <div class="layui-input-inline" style="width: 500px;">
                        <input type="radio" lay-skin="primary" name="liableType" value="1" title="原工程师" th:checked="${1 == conf.liableType || conf.liableType == null}"/>
                        <input type="radio" lay-skin="primary" name="liableType" value="2" title="当前工程师" th:checked="${2 == conf.liableType}"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">计入轮次：</label>
                    <div class="layui-input-inline">
                        <input type="radio" lay-skin="primary" name="countEnable" value="2" title="计入" th:checked="${2 == conf.countEnable || conf.countEnable == null}"/>
                        <input type="radio" lay-skin="primary" name="countEnable" value="1" title="不计入" th:checked="${1 == conf.countEnable}"/>
                    </div>
                    <div class="layui-form-mid layui-word-aux" style="font-size: 12px">指改派后，是否计入改派前订单的主工程师派单轮次</div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">排序：</label>
                    <div class="layui-input-inline">
                        <input type="number" placeholder="排序" id="sort" name="sort" th:value="${conf.sort}" lay-verify="required" class="layui-input"></input>
                    </div>
                    <div class="layui-form-mid layui-word-aux" style="font-size: 12px">数字越小，越在前面</div>
                </div>

                <div class="layui-form-item submit">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="zmn-form-submit">保存</button>
                        <button class="layui-btn layui-btn-primary" onclick="parent.layer.closeAll();">取消</button>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>

<script th:inline="javascript">
    let dataVo = [[${conf}]];

    layui.config({
        base: "/static/js/module/",
        version: version,
    }).extend({
        oms_conf_distributereason_detail: "conf/distributereason/zmn.oms.conf.distributereason.detail"
    }).use(['oms_conf_distributereason_detail']);
</script>

</body>
</html>